/*
 * Copyright (c) 2016- 2020 qolome.com Inc. All Rights Reserved.
 * ProjectName: qolome-knowledge
 * FileName: AuthenticationType.java
 * Author: jiangfeng@qolome.com
 * Date: 2020/3/15 下午4:57
 * LastModified: 2020/03/15 16:57:15
 */

package com.qolome.knowledge.design.pattern.strategy.demo.authentication;

import com.qolome.knowledge.design.pattern.strategy.demo.pay.*;

import java.util.HashMap;
import java.util.Map;

/**
 * @author Qolome
 * @version V1.0
 * @Description 认证类型
 * @date 2020年 03月15日 16:57:17
 */
public class AuthenticationType {

    public static  final String QQ = "QQ";
    public static  final String WECHAT= "Wechat";
    public static  final String TIKTOK = "Tiktok";
    public static  final String TEL = "tel";
    public static  final String DEFAULT = "tel";

    private static Map<String, AbstractAuthentication> strategy = new HashMap<>();

    static {
        strategy.put(QQ,new QqAuthentication());
        strategy.put(WECHAT,new WechatAuthentication());
        strategy.put(TIKTOK,new TiktokAuthentication());
        strategy.put(TEL,new TelAuthentication());

    }
    public  static  AbstractAuthentication get(String key){
        if(!strategy.containsKey(key)){
            return strategy.get(DEFAULT);
        }
        return strategy.get(key);
    }
}
